<include file="public@header"/>

<style type="text/css">
.textArea textarea{
	width:90%;padding:3%;height:80%;margin:0 auto;margin-top:30px;
	margin-left: 2%;
}
.textArea_btn{
	text-align: right;
	margin-top: 30px;
}
.textArea_btn input{
	margin-right: 30px;
}
</style>
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a >视频举报列表</a></li>

		</ul>
		<form class="well form-inline margin-top-20" method="post" action="{:url('Video/reportlist')}">

			状态：			
			<select class="form-control" name="status" style="width: 200px;">
				<option value="">全部</option>
				<option value="0" <if condition="input('request.status') eq '0'">selected</if> >处理中</option>
				<option value="1" <if condition="input('request.status') eq '1'">selected</if>>已处理</option>

			</select>&nbsp; &nbsp;
			
			
			提交时间：	
			<input type="text" name="start_time" class="js-bootstrap-date form-control" value="{:input('request.start_time')}" autocomplete="off" placeholder="开始时间">-
			<input type="text" name="end_time" class="js-bootstrap-date form-control" value="{:input('request.end_time')}" autocomplete="off" placeholder="结束时间">&nbsp; &nbsp;

			
			关键字：			
			 <input class="form-control" type="text" name="keyword" style="width: 200px;" value="{:input('request.keyword')}"
               placeholder="会员ID">
			   
			<input type="submit" class="btn btn-primary" value="搜索">
			<a class="btn btn-danger" href="{:url('Admin/Video/reportlist')}">清空</a>
		</form>				
		<form method="post" class="js-ajax-form" >

		
			<table class="table table-hover table-bordered">
				<thead>
					<tr>
						<th align="center">ID</th>
						<th>举报人</th>						
						<th>被举报人</th>
						<th>被举报视频ID</th>
						<th>举报内容</th>
						<th>状态</th>
						<th>提交时间</th>
						<th>处理时间</th>

						<th align="center">{:lang('ACTIONS')}</th>
					</tr>
				</thead>
				<tbody>
					<php>$status=array("0"=>"处理中","1"=>"已处理", "2"=>"审核失败");</php>
					<foreach name="lists" item="vo">
					<tr>
						<td align="center">{$vo.id}</td>
						<td>{$vo['userinfo']['user_nicename']} ( {$vo['uid']} )</td>	
						<td>{$vo['touserinfo']['user_nicename']} ( {$vo['touid']} )</td>		
						<td>{$vo['videoid']}</td>		
						<td><?php echo nl2br($vo['content']);?></td>				
						<td>{$status[$vo['status']]}</td>
						<td>{:date('Y-m-d H:i:s',$vo['addtime'])}</td>						
						<td>
						 <if condition="$vo['status'] eq '0'" >
						    处理中
						 <else/>
							{:date('Y-m-d H:i:s',$vo['uptime'])}
						 </if>						
						 </td>

						<td align="center">
							<a class="btn btn-xs btn-primary" href="javascript:void(0)" onclick="videoListen({$vo['videoid']})" >观看视频</a> 
							<if condition="$vo['status'] eq '0'" >
								<a class="btn btn-xs btn-danger js-ajax-delete" href="{:url('Video/setstatus',array('id'=>$vo['id']))}" data-msg="您确定要标记处理吗？" >标记处理</a>
							</if>
							<if condition="$vo['video_isdel'] neq '1'">
								<a class="btn btn-xs btn-danger " href="javascript:void (0)" onclick="xiajia({$vo['videoid']})" >下架视频</a>
							</if>
							<a href="{:url('Video/report_del',array('id'=>$vo['id']))}" class="btn btn-xs btn-danger js-ajax-delete" data-msg="您确定要删除吗？">删除举报</a>
						</td>
					</tr>
					</foreach>
				</tbody>
			</table>
			<div class="pagination">{$page}</div>

		</form>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
	<script src="__STATIC__/layer/layer.js"></script>
	<script type="text/javascript">


		var xiajia_status=0;

		function xiajia(id){
			var p={$p};

			layer.open({
			  type: 1,
			  title:"是否确定将该视频下架",
			  skin: 'layui-layer-rim', //加上边框
			  area: ['30%', '30%'], //宽高
			  content: '<div class="textArea"><textarea id="xiajia_reason" maxlength="50" placeholder="请输入下架原因,最多50字" /> </div><div class="textArea_btn" ><input type="button" id="xiajia" value="下架" onclick="xiajia_submit('+id+','+p+')" /><input type="button" id="cancel" onclick="layer.closeAll();" value="取消" /></div>'
			});
		}

		function xiajia_submit(id,p){

			var reason=$("#xiajia_reason").val();
			if(xiajia_status==1){
				return;
			}
			xiajia_status=1;
			$.ajax({
				url: '/admin/video/setXiajia.html',
				type: 'POST',
				dataType: 'json',
				data: {id:id,reason: reason},
				success:function(data){
					var code=data.code;
					if(code!=0){
						layer.msg(data.msg);
						return;
					}

					xiajia_status=0;
					$("#xiajia").attr("disabled",true);
					layer.msg("下架成功",{icon: 1,time:1000},function(){
						layer.closeAll();
						location.href='/admin/video/reportlist.html&p='+p;
						
					});
				},
				error:function(e){
					$("#xiajia").attr("disabled",false);
					console.log(e);
				}
			});
			
			
		}
	</script>


	<script type="text/javascript">
		function videoListen(id){

			layer.open({
			  type: 2,
			  title: '观看视频',
			  shadeClose: true,
			  shade: 0.8,
			  area: ['500px', '750px'],
			  content: '/admin/Video/video_listen.html&id='+id
			}); 
		}
	</script>
</body>
</html>